﻿
@{
    Layout = null;
}

<form id="myInfoForm">
    <div class="form-horizontal col-sm-6">
        <div class="form-group">
            <label for="LoginName" class="control-label col-sm-3">登录名：</label>
            <div class="col-sm-9">
                <input id="LoginName" name="LoginName" class="form-control" disabled value="admin" type="text">
            </div>
        </div>
        <div class="form-group">
            <label for="RelName" class="control-label col-sm-3">真实姓名：</label>
            <div class="col-sm-9">
                <input id="RelName" name="RelName" class="form-control" value="陈涵" type="text">
            </div>
        </div>
        <div class="form-group">
            <label for="Phone" class="control-label col-sm-3">手机号：</label>
            <div class="col-sm-9">
                <input id="Phone" name="Phone" class="form-control" value="18382130770" type="text">
            </div>
        </div>
        <div class="form-group">
            <label for="Email" class="control-label col-sm-3">邮箱：</label>
            <div class="col-sm-9">
                <input id="Email" name="Email" class="form-control" value="641712388@qq.com" type="text">
            </div>
        </div>
        <div class="form-group" style="text-align:center;">
            <span class="btn btn-primary formmyInfoSubmit">修改</span>
        </div>
    </div>

</form>

<script>
    $(function () {
        //前端无刷新验证
        var vForm = $("#myInfoForm").validate({
            errorElement: "span",
            rules: {

                 RelName: { required: true, minlength: 1, maxlength: 32 }

            },
            messages: {

                 RelName: { required: "必填信息", maxlength: "最长32位" }
            },
            submitHandler: function (form) {  //通过之后回调
                var arr = $("#myInfoForm").serialize();
                $.post("/Member/MyInfoModifySave", arr, function (data) {
                    if (data == "ok") {
                        alert("保存成功");

                    }
                    else {
                        if (data.type != 1) {
                            alert(data);
                        }
                    }
                });
            },
            invalidHandler: function (form, validator) {  //不通过回调
                return false;
            }
        });
        //提交数据
        $(".formmyInfoSubmit").click(function () {

            $("#myInfoForm").submit();
        });

    });


</script>


